package org.kuan.lab.common.service;

import java.io.Serializable;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.kuan.lab.common.entity.Dict;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

/**
 * Project: erp<br>
 * Description: 应用信息Service<br>
 * Copyright (c) 2012<br>
 * All Rights Reserved.<br>
 * @author <a href="mailto:gly420@163.com">GuanLuYong</a><br>
 */
@Service @Scope("request")
public class AppService implements Serializable {
	private static final long serialVersionUID = 1L;
	@PersistenceContext private EntityManager em;
	
	public List<Dict> getAllDicts() {
		String sql = "SELECT d FROM Dict d WHERE d.status=1";
		@SuppressWarnings("unchecked")
		List<Dict> dicts = em.createQuery(sql).getResultList();
		em.clear();
		return dicts;
	}

	public EntityManager getEm() {
		return em;
	}

	public void setEm(EntityManager em) {
		this.em = em;
	}

}
